<template>
  <el-form :model="authInfo" label-width="80px">
    <el-form-item label="用户名">
      <el-input v-model="authInfo.userName"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input type="password" v-model="authInfo.password"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="login">登录</el-button>
      <el-button type="primary" @click="reset">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import api from "@/api/controller";

export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: 'Login',
  props: {
  },
  data() {
    return {
      authInfo: {
        userName: "",
        password: ""
      }
    }
  },
  methods: {
    login: function () {
      let me = this
      console.log(this.authInfo.userName)
      api.authController.login({
        userName: me.authInfo.userName,
        password: me.authInfo.password
      }).then(function (response) {
        console.log(response);
        me.$router.push('/ui/utils');
      })
    },
    reset: function () {
      this.authInfo.userName = ''
      this.authInfo.password = ''
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
